package com.jy.api.payReq;

import com.thoughtworks.xstream.annotations.XStreamAlias;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.commons.lang3.StringUtils;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class AllPayRefundQueryResult {
    private String version;

    private String charset;

    private String signType;

    private String status;

    private String message;

    private String resultCode;

    private String mchId;

    private String deviceInfo;

    private String nonceStr;

    private String errCode;

    private String errMsg;

    private String sign;

    private String transactionId;

    private String outTradeNo;

    private int refundCount;

    private String outRefundNo;

    private String refundId;


    private String refundChannel;

    private int refundFee;

    private String refundTime;

    private String refundStatus;

    public boolean isSuccess() {
        if (status.equals("0") && StringUtils.isNotEmpty(resultCode) && resultCode.equals("0") && refundStatus.equalsIgnoreCase("SUCCESS")) {
            return true;
        } else {
            return false;
        }
    }

    public boolean isProcessing() {
        if (status.equals("0") && StringUtils.isNotEmpty(resultCode) && resultCode.equals("0") && refundStatus.equalsIgnoreCase("PROCESSING")) {
            return true;
        } else {
            return false;
        }
    }
}
